package com.baichang.taoshunda.controller.mobile.business;

import com.baichang.framework.controller.BaseMobileController;
import com.baichang.framework.controller.IService;
import com.baichang.framework.excelption.ServiceException;
import com.baichang.taoshunda.controller.ControllerConstants;
import com.baichang.taoshunda.service.LinkUrlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping(ControllerConstants.BUSSINESSLINK)
public class BussinessLinkMController extends BaseMobileController {
    @Autowired
    private LinkUrlService linkUrlService;

    /**
     * 根据编号获取链接地址
     *
     * @param request
     * @param response
     */
    @RequestMapping("/getLinkUrlById")
    public void getLinkUrlById(HttpServletRequest request, HttpServletResponse response) {
        initEncode(request, response, new IService() {
            @Override
            public Object init(HttpServletRequest request, HttpServletResponse response, String json) throws ServiceException {
                Integer id = getInt(json, "id", 0);
                return linkUrlService.getLinkUrlById(id);
            }
        });
    }


}
